let isShowIng = false;
let showTimer, closeTimer;


function show() {

	if (isShowIng) {
		return;
	}
	if (showTimer) {
		clearTimeout(showTimer);
	}

	showTimer = setTimeout(() => {
		uni.showLoading({
			title: '加载中...',
			mask: true,
			complete: () => {
				isShowIng = true;
			}
		})
	}, 500);

	if (closeTimer) {
		clearTimeout(closeTimer)
	}
	closeTimer = setTimeout(() => {
		if (isShowIng) {
			uni.hideLoading();
		}
	}, 10 * 1000);

}

function hide() {
	if (isShowIng) {
		uni.hideLoading();
	}

	if (showTimer) {
		clearTimeout(showTimer);
	}
	isShowIng = false;
}


export default {
	show: show,
	hide: hide,
}
